package com.zyb.dfs.backupnode.server;

import org.omg.CORBA.PUBLIC_MEMBER;

/**
 * 负责同步editslog的进程
 */
public class BackupNode {

    private volatile Boolean isRunning = true;
    private FSNamesystem namesystem;
    private NameNodeRpcClient namenode;

    public static void main(String[] args) throws Exception {
        BackupNode backupNode = new BackupNode();
        backupNode.init();
        backupNode.start();
    }

    public void init() {
        this.namesystem = new FSNamesystem();
        this.namenode = new NameNodeRpcClient();
    }

    public void start() throws Exception {
        EditsLogFetcher editsLogFetcher = new EditsLogFetcher(this, namesystem, namenode);
        editsLogFetcher.start();
        FsImageCheckpoiner fsImageCheckpoiner = new FsImageCheckpoiner(this, namesystem, namenode);
        fsImageCheckpoiner.start();
    }

    public Boolean isRunning() {
        return this.isRunning;
    }
}
